<template>
	<view class="page">
		<view class="feedback-title"><text>意见或建议</text></view>
		<view class="feedback-body"><textarea placeholder="请描述你的意见或建议..." v-model="content" class="feedback-textare" /></view>
		<button type="primary" class="feedback-submit" @tap="send">提交</button>
	</view>
</template>
<script>
import { mapState, mapMutations } from 'vuex';
export default {
	computed: {
		...mapState(['TOKEN', 'UPDATE', 'URL'])
	},
	data() {
		return {
			content: '',
			id: ''
		};
	},
	onLoad(e) {
		this.id = e.id;
	},
	methods: {
		...mapMutations(['TO_UPDATE']),
		send() {
			console.log(this.id);
			console.log(this.TOKEN);
			console.log(this.content);
			//发送反馈
			uni.request({
				url: this.URL + 'bxTEstimate/comment',
				data: {
					mainId: this.id,
					esContent: this.content
				},
				header: {
					token: this.TOKEN
				},
				success: res => {
					this.TO_UPDATE(true);
					uni.showToast({
						title: res.data.message,
						icon:'none'
					});
					if (res.data.success) {
						setTimeout(() => {
							uni.navigateBack();
						}, 2000);
					}
					console.log(JSON.stringify( res.data ));
				}
			});
		}
	}
};
</script>

<style>
.page {
	background-color: #efeff4;
	width: 750upx;
}

.input-view {
	font-size: 28upx;
}
</style>
